var http = require('http');
var url = require('url');
var server = http.createServer(function(req,res) {
    var pathname = url.parse(req.url).pathname; //解析路由请求地址
    var params = url.parse(req.url, true).query; //解析请求参数
    
    console.log(req.method+" Request for " + pathname + " received."); //打印请求

    res.writeHead(200, { 'Content-Type': 'text/plain' });
    res.write(req.method);
    res.write('\npathname:'+pathname);
    res.write('\nparams:'+JSON.stringify(params));
    res.end();
}).listen(3000);
console.log('start');